Skip to content

Hamul

RSA could be hard, or easy?

Files given:

python
nbit = 64
while True:
	p, q = getPrime(nbit), getPrime(nbit)
	P = int(str(p) + str(q))
	Q = int(str(q) + str(p))
	PP = int(str(P) + str(Q))
	QQ = int(str(Q) + str(P))
	if isPrime(PP) and isPrime(QQ):
		break

This challenge generates our primes with the above method. In order to understand what's going on, we can rewrite in terms of . Let be the number of decimal digits of respectively, then

Looking closely at the expansion, it tells us that by taking the first and last -ish digits of , we get a very good approximation of . Since we know , we expect the length to be , hence we simply brute force a little by hand until yafu factorization finds only two prime factors of

PQ = 
9802713296337413422\
272498467780536422550545430268877750619346836296911192794023888752291658602460169966140187114767462486843957741638712\
2924526713690754043
pq =
9802713296337413421\
2924526713690754043

Solution at solve.py

Flag: CCTF{wH3Re_0Ur_Br41N_Iz_5uP3R_4CtIVe_bY_RSA!!}